<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <title>翼充电</title>
    <link type="text/css" rel="stylesheet" href="../static/css/font-awesome.min.css">
    <link type="text/css" rel="stylesheet" href="../static/css/style.css">
    <style>
        .resumeBtn {
            color: #ffffff;
            width: 30%;
            text-decoration: none;
            padding: 8px 15px;
            box-shadow: 0 0 1px 0px #ffffff;
            border-radius: 4px;
            text-align: center;
            cursor: pointer;
            letter-spacing: 1px;
            border: none;
            outline: none;
        }

        .resumeBtn:first-child {
            background-color: #FFAA00;
        }

        .resumeBtn:last-child {
            background-color: #00B7EE;
        }

        .resumeBtn:disabled {
            background-color: #cccccc;
        }
    </style>
</head>
<body class="uf uf-ver uf-pja" style="color: #ffffff;">

<h2 style="padding: 3rem 0 1rem 0;text-align: center;margin: 0;letter-spacing: 1px;"><i class="fa fa-plug"
                                                                                        aria-hidden="true"></i>&nbsp;充电意外停止了
</h2>
<div style="font-size: 3rem;text-align: center;">(；′⌒`)</div>
<div style="text-align: center;padding: 15px 0 5px 0;font-size: .925rem;"><span id="timeLast">5分钟</span>后自动恢复充电</div>
<div class="uf uf-pja" style="padding: 0 0 1rem 0;">
    <button class="resumeBtn">我不充了</button>
    <button class="resumeBtn">立即恢复</button>
</div>


<script type="text/javascript" src="../static/js/jquery.min.js"></script>
<script type="text/javascript" src="../static/js/jqToast.js"></script>
<script type="text/javascript" src="../static/js/layer_mobile/layer.js"></script>
<script type="text/javascript" src="../static/js/tool.js"></script>
<script>
    $(function () {
        timeLastFc(1000 * 60 * 5);//毫秒
    });

    //倒计时
    var timeLastInterval;

    function timeLastFc(timeLast) { //毫秒
        timeLast = timeLast / 1000;
        timeLastInterval = setInterval(function () {
            if (timeLast > 0) {
                timeLast--;
                document.getElementById("timeLast").innerHTML = formatSeconds(timeLast);
            } else {
                clearInterval(timeLastInterval);
            }

        }, 1000);
    }

    /**
     *格式化秒
     * @param value 秒数
     * @returns {string}
     */
    function formatSeconds(value) {
        var secondTime = parseInt(value);// 秒
        var minuteTime = 0;// 分
        var hourTime = 0;// 小时
        if (secondTime > 59) {//如果秒数大于60，将秒数转换成整数
            //获取分钟，除以60取整数，得到整数分钟
            minuteTime = parseInt(secondTime / 60);
            //获取秒数，秒数取佘，得到整数秒数
            secondTime = parseInt(secondTime % 60);
            //如果分钟大于60，将分钟转换成小时
            if (minuteTime > 59) {
                //获取小时，获取分钟除以60，得到整数小时
                hourTime = parseInt(minuteTime / 60);
                //获取小时后取佘的分，获取分钟除以60取佘的分
                minuteTime = parseInt(minuteTime % 60);
            }
        }

        var secondStr = parseInt(secondTime) > 9 ? parseInt(secondTime) : '0' + parseInt(secondTime);
        var minuteStr = '00';
        if (minuteTime > 0) {
            minuteStr = parseInt(minuteTime) > 9 ? parseInt(minuteTime) : '0' + parseInt(minuteTime)
        }
        var hourStr = '00';
        if (hourTime > 0) {
            hourStr = parseInt(hourTime) > 9 ? parseInt(hourTime) : '0' + parseInt(hourTime);
            return hourStr + '小时' + minuteStr + '分钟' + secondStr + '秒';
        }
        if (!(hourTime > 0) && !(minuteTime > 0)) {
            return secondStr + '秒';
        }
        return minuteStr + '分钟' + secondStr + '秒';
    }
</script>
</body>
</html>